package com.briup.app2.web.controller;

import com.briup.app2.bean.Test;
import com.briup.app2.service.ITestService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(description="栏目管理相关接口")
@RestController
@RequestMapping("/Test")
public class TestController {
    @Qualifier("ITestService")
    @Autowired
    private ITestService testService;

    @GetMapping
    public List<Test> findAll(){

        return testService.findAll();
    }
    @GetMapping("save")
    public String save(Test test){
        testService.save(test);
        return "保存成功";
    }

    @PostMapping ("update")
    public String update(Test test){
        testService.update(test);
        return "更新成功";
    }
    @PostMapping("delete")
    public String delete(Test test){
        testService.delete(test);
        return "删除成功";
    }
}
